import React, { useEffect, useState } from "react";
import { View, Image, Text } from '@tarojs/components'
import { Cell, Button, } from '@antmjs/vantui'
import Taro, { useDidShow } from '@tarojs/taro';

import './index.scss'
import { NavBar } from "@/components";
import { getPersonalCertiInfo } from "@/services/api/user";


function AlRealName() {

  const { statusBarHeight } = Taro.getSystemInfoSync()


  const [personalCertiInfo, setPersonalCertiInfo]: any = useState({})

  useEffect(() => {
    // 如果用户首次进入
    getPersonalCertInfoData()
  }, [])

  const getPersonalCertInfoData = async () => {
    getPersonalCertiInfo(true).then(res1 => {
      if (res1.code === 200) {
        setPersonalCertiInfo(res1.data);
      }
    })
  }

  /**
  * 对应 onShow
  */
  useDidShow(() => {
    console.log('onShow')
  })


  return (
    <View className='set-index'>
      <NavBar name=''></NavBar>
      <View className='desc' style={{ paddingTop: statusBarHeight + 44 + 8 }}>
        <Image className='done_img' src={require('@/assets/icons/mine/realname_done.svg')} />
        <Text className='done_title'>认证完成</Text>
        <View className='line_context'>
          <View className='line line_left'></View>
          <View className='dont_context'>
            <View className='dont'></View>
            <View className='dont'></View>
            <View className='dont'></View>
          </View>

          <View className='line line_right'></View>
        </View>
        <Text className='name'>{personalCertiInfo.name}</Text>
        <Text className='idcards'>{personalCertiInfo.credCode}</Text>
      </View>

    </View>


  )
}

export default AlRealName
